﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Dracham.MapEditor.Maps;
using Dracham.MapEditor.Singleton;

namespace Dracham.MapEditor
{
    public partial class frmSelectZone : Form
    {
        public Zone Zone { get; private set; }
        public frmSelectZone()
        {
            InitializeComponent();

            foreach (Zone zone in DrachamMapEditor.ZoneManager.Zones)
            {
                lstZones.Items.Add(zone);
            }
        }

        private void btnSelect_Click(object sender, EventArgs e)
        {
            if (this.lstZones.SelectedItem != null)
            {
                this.Zone = (Zone)lstZones.SelectedItem;

                this.DialogResult = DialogResult.OK;
            }
        }

        private void lstZones_DoubleClick(object sender, EventArgs e)
        {
            btnSelect_Click(sender, e);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
